package nccu.webapp.controller;

import nccu.service.GenericManager;
import nccu.model.CreditUnion;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping("/creditunions*")
public class CreditUnionController {

    private GenericManager<CreditUnion, Long> creditUnionManager;

    @Autowired
    public void setBankManager(@Qualifier("creditUnionManager") GenericManager<CreditUnion, Long> creditUnionManager) {
        this.creditUnionManager = creditUnionManager;
    }

    @RequestMapping(method = RequestMethod.GET)
    public ModelAndView handleRequest()
    throws Exception {
        return new ModelAndView().addObject(creditUnionManager.getAll());
    }
}
